package weektwo_day03_thread;

import java.io.File;
import java.io.IOException;

public class Download {
	public static void main(String[] args) throws IOException {
		File file = new File("Ingrid Michaelson - Girls Chase Boys.mp3");
		int offset = (int) ((int)file.length() / 4);			
		int length = offset + (((int)file.length()) % 4);
		
		VideoThread threadArray[] = new VideoThread[5];
		int pointer = 0;
		for(int i = 0; i < 4; i++){
			threadArray[i] = new VideoThread(offset, pointer);
			pointer += offset;
		}
		threadArray[4] = new VideoThread(length, 4 * offset);
		
		for(int i = 0; i < threadArray.length; i++){
			threadArray[i].start();
		}
	}
}
